// test
package Ontology;

import dbindex.Language;
import dbcontext.ClassTable;

public class Classes
{
    private int iClassID;				//	Identifier of class
    private String sClassName;			//	Name of class
    private int iParentID;				//	reference to parent in the taxonomy 
    private boolean bIsLeaf;			//	the leaf in the taxonomy
    private boolean bIsMarked;			//	marked	2think
    private boolean bIsAllAttrMarked;	//	Is all the attributes are marked
    private int iPosInClassAttr;
    private boolean bHasInheritedAttr;	//	Is all the attributes are marked
    private boolean bAllAttrInherited;	//	Is all the attributes are marked
    private boolean bIsInserted;		//	For the second step of the algorithm - we should insert Parent classes. They can be found several times. 
    private String sClassDescr;			//	Description of class
    private boolean bIsHierProc;		//	Is Hierarchy relation processed
    private boolean bIsAssocProc;		//	Is associative relation processed
    private boolean bIsAssocProcInh;		//	Is inherited associative relation processed
    private String sStemClassName;		//	Stemmed Name of class
    private String sStemClassDescr;		//	Stemmed Description of class
    private int iBaseOntoID;
    private int iPositionOfParent;		//	for TMO. position of parent in vResClass

    /**
     * @deprecated replaced by Classes with sStemClassName
     */
    public Classes ( int iiClassID, String isClassName, int iiParentID, boolean ibIsLeaf, String isClassDescr )
    {
    	iClassID = iiClassID;
    	sClassName = isClassName;
    	iParentID = iiParentID;
    	bIsLeaf = ibIsLeaf;
    	bIsMarked = false;		// 2think
    	bIsAllAttrMarked = false;
    	iPosInClassAttr = 0;
    	bHasInheritedAttr = false;
    	bAllAttrInherited = false;
    	bIsInserted = false;
    	sClassDescr = isClassDescr;
        bIsHierProc = false;
        bIsAssocProc = false;
        bIsAssocProcInh = false;
        iPositionOfParent = 0;
    }

    /**
     * @deprecated replaced by Classes with sStemClassName
     */
    public Classes ( int iiClassID, String isClassName, int iiParentID, boolean ibIsLeaf, String isClassDescr, String isStemClassName, String isStemClassDescr )
    {
    	iClassID = iiClassID;
    	sClassName = isClassName;
    	iParentID = iiParentID;
    	bIsLeaf = ibIsLeaf;
    	bIsMarked = false;		// 2think
    	bIsAllAttrMarked = false;
    	iPosInClassAttr = 0;
    	bHasInheritedAttr = false;
    	bAllAttrInherited = false;
    	bIsInserted = false;
    	sClassDescr = isClassDescr;
        bIsHierProc = false;
        bIsAssocProc = false;
        bIsAssocProcInh = false;
    	sStemClassName = isStemClassName;
    	sStemClassDescr = isStemClassDescr;
    	iPositionOfParent = 0;
    }
    
    public Classes ( int iiClassID, String isClassName, int iiParentID, boolean ibIsLeaf, String isClassDescr, String isStemClassName, String isStemClassDescr, int iiBaseOntoID )
    {
    	iClassID = iiClassID;
    	sClassName = isClassName;
    	iParentID = iiParentID;
    	bIsLeaf = ibIsLeaf;
    	bIsMarked = false;		// 2think
    	bIsAllAttrMarked = false;
    	iPosInClassAttr = 0;
    	bHasInheritedAttr = false;
    	bAllAttrInherited = false;
    	bIsInserted = false;
    	sClassDescr = isClassDescr;
        bIsHierProc = false;
        bIsAssocProc = false;
        bIsAssocProcInh = false;
    	sStemClassName = isStemClassName;
    	sStemClassDescr = isStemClassDescr;
    	iBaseOntoID = iiBaseOntoID;
    	iPositionOfParent = 0;
    }

    public Classes ( Classes iclClassTemplate )
    {
        iClassID = iclClassTemplate.getClassID();
        sClassName = iclClassTemplate.getClassName();
        iParentID = iclClassTemplate.getParentID(); 
        bIsLeaf = iclClassTemplate.getIsLeaf();
        bIsMarked = iclClassTemplate.getIsMarked();
        bIsAllAttrMarked = iclClassTemplate.getIsAllAttrMarked();
        iPosInClassAttr = iclClassTemplate.getPosInClassAttr();
        bHasInheritedAttr = iclClassTemplate.getHasInheritedAttr();
        bAllAttrInherited = iclClassTemplate.getAllAttrInherited();
        bIsInserted = iclClassTemplate.getIsInserted(); 
        sClassDescr = iclClassTemplate.getClassDescr();
        bIsHierProc = iclClassTemplate.getIsHierProc();
        bIsAssocProc = iclClassTemplate.getIsAssocProc();
        bIsAssocProcInh = iclClassTemplate.getIsAssocProcInh();
        sStemClassName = iclClassTemplate.getStemClassName();
        sStemClassDescr = iclClassTemplate.getStemClassDescr();
        iBaseOntoID = iclClassTemplate.getBaseOntoID();
        iPositionOfParent = iclClassTemplate.getPositionOfParent();
    }

    public String toString() 
    {
        return "ClassID: " + iClassID + "//" + iParentID + " ClassName: " + sClassName + 
        		"\n   IsLeaf: " + bIsLeaf + " IsInserted: " + bIsInserted + " IsMarked: " + bIsMarked + 
        		"\n   IsAllAttrMarked: " + bIsAllAttrMarked + " IsAllAttrInherited " + bAllAttrInherited;
    }
    public String toFile() 
    {
        return "ClassID:\n" + 
        		iClassID + "\n" + 
        		iParentID + "\n" +
        		sClassName + "\n" +
        		sClassDescr;
    }
    public String toFileWithTab() 
    {
        return "" + iClassID + "\t" + 
        		iParentID + "\t" +
        		iBaseOntoID + "\t" +
        		sClassName + "\t" +
        		sClassDescr;
    }
    
    /** Stores data to the table 'class' */
    public void toDatabase( java.sql.Connection conn, 
                            Language lang,
                            int onto_id)
    {
        ClassTable.insert( conn, lang, iClassID, iParentID, 
                           onto_id, iBaseOntoID,  sClassName, sClassDescr);
    }
    
    public int getClassID() 
    {
        return iClassID;
    }
    public int getParentID() 
    {
        return iParentID;
    }
    public String getClassName() 
    {
        return sClassName;
    }
    public String getStemClassName() 
    {
        return sStemClassName;
    }
    public String getClassDescr() 
    {
        return sClassDescr;
    }
    public String getStemClassDescr() 
    {
        return sStemClassDescr;
    }
    public boolean getIsLeaf() 
    {
        return bIsLeaf;
    }
    public boolean getIsMarked() 
    {
        return bIsMarked;
    }
    public boolean getIsAllAttrMarked() 
    {
        return bIsAllAttrMarked;
    }
    public int getPosInClassAttr() 
    {
        return iPosInClassAttr;
    }
    public boolean getHasInheritedAttr() 
    {
        return bHasInheritedAttr;
    }
    public boolean getAllAttrInherited() 
    {
        return bAllAttrInherited;
    }
    public boolean getIsInserted() 
    {
        return bIsInserted;
    }
    public boolean getIsHierProc() 
    {
        return bIsHierProc;
    }
    public boolean getIsAssocProc() 
    {
        return bIsAssocProc;
    }
    public boolean getIsAssocProcInh() 
    {
        return bIsAssocProcInh;
    }
    public int getBaseOntoID() 
    {
        return iBaseOntoID;
    }
    public int getPositionOfParent()
    {
        return iPositionOfParent;
    }
   
    public void setIsMarked( boolean ibIsMarked ) 
    {
        bIsMarked = ibIsMarked;
    }
    public void setIsAllAttrMarked( boolean ibIsAllAttrMarked ) 
    {
        bIsAllAttrMarked = ibIsAllAttrMarked;
    }
    public void setPosInClassAttr( int iiPosInClassAttr ) 
    {
        iPosInClassAttr = iiPosInClassAttr;
    }
    public void setHasInheritedAttr( boolean ibHasInheritedAttr ) 
    {
        bHasInheritedAttr = ibHasInheritedAttr;
    }
    public void setAllAttrInherited( boolean ibAllAttrInherited ) 
    {
        bAllAttrInherited = ibAllAttrInherited;
    }
    public void setIsInserted( boolean ibIsInserted ) 
    {
        bIsInserted = ibIsInserted;
    }
    public void setParentID( int iiParentID ) 
    {
        iParentID = iiParentID;
    }
    public void setIsHierProc( boolean ibIsHierProc ) 
    {
        bIsHierProc = ibIsHierProc;
    }
    public void setIsAssocProc( boolean ibIsAssocProc ) 
    {
        bIsAssocProc = ibIsAssocProc;
    }
    public void setIsAssocProcInh( boolean ibIsAssocProcInh ) 
    {
        bIsAssocProcInh = ibIsAssocProcInh;
    }
    public void setPositionOfParent( int iiPositionOfParent ) 
    {
        iPositionOfParent = iiPositionOfParent;
    }
}